<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">

<head>
  <meta charset="UTF-8">
  <title>订单列表-WeAdmin Frame型后台管理系统-WeAdmin 1.0</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../../static/css/font.css">
  <link rel="stylesheet" href="../../../static/css/weadmin.css">
  <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
  <script src="../../../static/lib/layui/layui.js" charset="utf-8"></script>
  <script>
    $.get({
      url: "/order/list",
      success: function (data) {
        $("#orderList").html(data)
      }
    })
  </script>
</head>

<body>
  <div class="weadmin-nav">
    <span class="layui-breadcrumb">
      <a href="">首页</a>
      <a href="">订单管理</a>
      <a><cite>订单列表</cite></a>
    </span>
    <a class="layui-btn layui-btn-sm" style="margin-top:3px;float:right"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="layui-icon layui-icon-refresh"></i></a>
  </div>
  <div class="weadmin-body">
    <div class="layui-row">
      <form class="layui-form layui-col-md12 we-search">
        <div class="layui-inline">
          <input class="layui-input" placeholder="开始日" name="start" id="start">
        </div>
        <div class="layui-inline">
          <input class="layui-input" placeholder="截止日" name="end" id="end">
        </div>
        <div class="layui-input-inline">
          <select name="controller">
            <option>支付方式</option>
            <option value="支付宝">支付宝</option>
            <option value="微信">微信</option>
            <option value="货到付款">货到付款</option>
          </select>
        </div>
        <div class="layui-input-inline">
          <select id="shipping" name="shipping" class="valid">
            <option>配送方式</option>
            <option value="顺丰物流">顺丰物流</option>
            <option value="顺丰物流">京东物流</option>
            <option value="申通物流">申通物流</option>
            <option value="顺丰物流">中通物流</option>
            <option value="顺丰物流">圆通物流</option>
          </select>
        </div>
        <div class="layui-inline">
          <input type="text" name="orderId" placeholder="请输入订单号" autocomplete="off" class="layui-input">
        </div>
        <button class="layui-btn search-btn" lay-submit="" lay-filter="search">
          <i class="layui-icon layui-icon-search"></i>
        </button>
      </form>
    </div>
    <div class="weadmin-block">
      <button class="layui-btn layui-btn-danger" onclick="delAll()"><i
          class="layui-icon layui-icon-delete"></i>批量删除</button>
      <button class="layui-btn" onclick="WeAdminShow('添加订单','./add.html')"><i
          class="layui-icon layui-icon-add-circle-fine"></i>添加</button>
      <span class="fr" style="line-height:40px">共有数据：<span>[[${session.orderNum}]]</span> 条</span>
    </div>
    <table class="layui-table" id="orderList" th:fragment="orderList">
      <thead>
        <tr>
          <th>
            <div class="layui-unselect header layui-form-checkbox" lay-skin="primary">
              <i class="layui-icon layui-icon-ok"></i>
            </div>
          </th>
          <th>订单编号</th>
          <th>收货人</th>
          <th>手机号码</th>
          <th>收货地址</th>
          <th>总金额</th>
          <th>支付方式</th>
          <th>配送方式</th>
          <th>发票编号</th>
          <th>下单时间</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody th:each="order : ${session.orders}">
        <tr th:data-id="${order.orderId}" th:user-id="${order.customerId}">
          <td>
            <div class="layui-unselect header layui-form-checkbox" lay-skin="primary" th:data-id="${order.orderId}">
              <i class="layui-icon layui-icon-ok"></i>
            </div>
          </td>
          <td>[[${order.orderId}]]</td>
          <td>[[${order.name}]]</td>
          <td>[[${order.phone}]]</td>
          <td>[[${order.address}]]</td>
          <td>[[${order.orderSum}]]</td>
          <td>[[${order.payMethod}]]</td>
          <td>[[${order.sendMethod}]]</td>
          <td>[[${order.invoice}]]</td>
          <td>[[${order.createTime}]]</td>
          <td class="td-manage">
            <a title="查看" onclick="WeAdminEdit('编辑订单','./edit.html', this, 1097, 500)" href="javascript:;">
              <i class="layui-icon layui-icon-edit"></i>
            </a>
            <a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
              <i class="layui-icon layui-icon-delete"></i>
            </a>
          </td>
        </tr>
      </tbody>
    </table>
    <div class="page">
      <div class="list" th:fragment="page">
        <span class="num" th:each="page:${session.orderPages}" th:uuid="${page}">[[${page}]]</span>
      </div>
    </div>

  </div>
  <script src="../../../static/js/orderDel.js"></script>

  <!--  查找用户-->
  <script>
    layui.use(['form', 'layer', "jquery"], function () {
      var form = layui.form,
              layer = layui.layer,
              $ = layui.jquery;

      //监听提交
      form.on('submit(search)', function (data) {
        var f = data.field;
        var start = f.start;
        var end = f.end;
        var controller = f.controller == "支付方式" ? null : f.controller;
        var shipping = f.shipping == "配送方式" ? null : f.shipping;
        var id = f.orderId
        if(start!="" || end!="" || controller!= "" || shipping!="" || id!="") {
          var find_data = {start: start,end: end, payMethod: controller, sendMethod: shipping, orderId: id}
          $.post({
            url: "/order/find",
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify(find_data),
            success: function (data) {
              $("#orderList").html(data)
              $(".num[uuid=1]").addClass("current")
              $(".num[uuid=1]").siblings().removeClass("current")
            }
          })
        }
        return false;
      });
    });
  </script>

<!--  换页-->
  <script>
    $(".num[uuid=1]").addClass("current")
    $(".num").click(function () {
      var page = $(this).attr("uuid")
      $.post({
        url: "/order/page/"+page,
        contentType: "application/json;charset=UTF-8",
        success: function (data) {
          $("#orderList").html(data)
        },
        async: false
      })
      $(this).addClass("current")
      $(this).siblings().removeClass("current")
    })
  </script>

</body>

</html>